<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui">
<h:body>
	<ui:composition template="/pages/protected/templates/master.xhtml">
		<ui:define name="divMain">
			<h:form id="dogsForm">
				<p:dataTable id="dogsTable" value="#{dogMB.allDogs}" var="dog" emptyMessage="#{bundle.noRecords}" paginator="true" rows="10"
					paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="5,10,15">
					<p:column>
						<f:facet name="header">
							<h:outputText value="#{bundle.dogName}" />
						</f:facet>

						<h:outputText value="#{dog.name}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="#{bundle.dogAge}" />
						</f:facet>

						<h:outputText value="#{dog.age}" />
					</p:column>
					<p:column>
						<p:commandButton value="#{bundle.detail}" icon="ui-icon-bullet" onclick="dogDetailDialogWidget.show();" update=":dogDetailDialogForm" >
							<f:setPropertyActionListener target="#{dogMB.dog}" value="#{dog}" />
						</p:commandButton> 
						<p:spacer width="10px" />
						<p:commandButton value="#{bundle.update}" icon="ui-icon-pencil" update=":dogUpdateDialogForm" onclick="dogUpdateDialogWidget.show();" >
							<f:setPropertyActionListener target="#{dogMB.dog}" value="#{dog}" />
						</p:commandButton>
						<p:spacer width="10px" />
						<p:commandButton value="#{bundle.delete}" icon="ui-icon-trash" update=":dogDeleteDialogForm" onclick="dogDeleteDialogWidget.show();" >
							<f:setPropertyActionListener target="#{dogMB.dog}" value="#{dog}" />
						</p:commandButton>
					</p:column>

				</p:dataTable>
				<p:commandButton value="#{bundle.create} #{bundle.dog}" icon="ui-icon-plus" update=":dogCreateDialogForm"
					actionListener="#{dogMB.resetDog()}" onclick="dogCreateDialogWidget.show();" />
			</h:form>

			<ui:include src="/pages/protected/admin/dialogs/dogCreateDialog.xhtml" />
			<ui:include src="/pages/protected/admin/dialogs/dogDetailDialog.xhtml" />
			<ui:include src="/pages/protected/admin/dialogs/dogUpdateDialog.xhtml" />
			<ui:include src="/pages/protected/admin/dialogs/dogDeleteDialog.xhtml" />
		</ui:define>
	</ui:composition>
</h:body>
</html>